package java6681.bank;

import javax.swing.*;

public class Account6681 {
    private String id;
    private String name;
    private double balance;


    public Account6681() {

    }

    public Account6681(String name, double balance) {
        super();
        this.name = name;
        if (checkMoney6681(balance)) {
            this.balance = balance;
        } else {
            this.balance = 0;
        }
    }

    public String getId() {
        return id;
    }

    protected void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public final void deposit6681(double saveMoney) {
        if (checkMoney6681(saveMoney)) {
            balance += saveMoney;
        }
    }

    public void withdraw6681(double getMoney) {

    }

    public static boolean checkMoney6681(double money) {
        if (money <= 0) {
            JOptionPane.showMessageDialog(null,
                    "金额必须大于0"
                    , "系统提示", JOptionPane.ERROR_MESSAGE);
            return false;
        }
        return true;
    }


    @Override
    public String toString() {
        return
                "账户ID='" + id + '\'' +
                        ", 客户姓名='" + name + '\'' +
                        ", 余额=" + balance;
    }
}
